package net.eearley.redpoint.app.utils;

import java.util.List;

/**
 * The Class Util.
 */
public class Util {

	/**
	 * Checks if is integer.
	 * 
	 * @param val
	 *            the val
	 * 
	 * @return true, if is integer
	 */
	public static boolean isInteger(char val) {
		return isInteger(val + "");
	}

	/**
	 * Checks if is integer.
	 * 
	 * @param val
	 *            the val
	 * 
	 * @return true, if is integer
	 */
	public static boolean isInteger(String val) {
		try {
			Integer.parseInt(val);
			return true;
		} catch (NumberFormatException e) {
			return false;
		}
	}

	/**
	 * List to string.
	 * 
	 * @param l
	 *            the l
	 * 
	 * @return the string
	 */
	public static String listToString(List<?> l) {
		StringBuilder sb = new StringBuilder();
		for (Object object : l) {
			sb.append(object.toString());
		}
		return sb.toString().trim();
	}
}
